#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int MAXK = 51;
const int ITER = 1500;
int N;
double p, q, a[MAXK][MAXK], dp[2][MAXK];

void solve()
{
    for(size_t i=0; i<MAXK; i++){
        for (size_t k = 0; k < MAXK; k++) {
            /* code */
            if(i==0) a[i][k]=0;
            else if(k==1) a[i][k]=p;
            else if(i==1&&k==2) a[i][k]=q;
            else if(i>1&&k==2) a[i][k]=p*p+q;
            else if(i==1&&k>2) a[i][k]=0;
            else a[i][k]=a[i][k-1]*a[i-1][k-1];
        }
    }
    int iter = min(ITER, N);
    for (int i = iter; i>0; i--) {
        for(int j=1; j<MAXK; j++){
            dp[0][j]=j;
            if(i<iter){
                int rev = min(iter-i,MAXK-1);
                double num=0;
                double denom=0;
                if(j==1){
                    for(int k=2; k<MAXK; k++){
                        double prob = a[rev][k]*(1-a[rev-1][k]);
                        num += prob*dp[1][k];
                        denom += prob;
                    }
                }else if(j>1){
                    for(int k=1; k<j; ++k){
                        double prob=a[rev][k]*(1-a[rev-1][k]);
                        num += prob*dp[1][k];
                        denom += prob;
                    }
                }
                dp[0][j] += num/denom;
            }
        }
        swap(dp[0], dp[1]);
    }
}

int main(int argc, char **argv)
{
    int x;
    scanf("%d%d",&N,&x);
    p=(double)x/1000000000;
    q=1-p;
    solve();
    double ans=0;
    int i=min(MAXK-1, N);
    int sur = max(0, N-ITER);
    for(int k=1; k<=50; k++)
        ans += a[i][k]*(1-a[i-1][k])*(dp[1][k]+sur*(dp[1][k]-dp[0][k]));
    printf("%.15f\n", ans);
    return 0;
}
